package Thread;

//获取线程的想关信息
public class ThreadAPI2 {
    public static void main(String[] args) {
        //获取main方法的线程
        Thread main=Thread.currentThread();

        Long id=main.getId();
        System.out.println("id:"+id);


        String name=main.getName();
        System.out.println("name:"+name);


        int priority=main.getPriority();
        System.out.println("优先级:"+priority);

        boolean isAlive=main.isAlive();
        System.out.println("是否存活："+isAlive);

        boolean isDaemon=main.isDaemon();
        System.out.println("是否为守护线程:"+isDaemon);

        boolean interrupted=main.isInterrupted();
        System.out.println("是否中断:"+interrupted);
    }
}
